<!--
@license
Copyright 2016 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../paper-slider/paper-slider.html">

<link rel="import" href="styles.html">
<link rel="import" href="vz-projector-input.html">

<dom-module id="vz-projector-inspector-panel">
<style include="vz-projector-styles"></style>
<style>
:host {
   display: flex;
   flex-direction: column;
   /* Account for the bookmark pane at the bottom */
   height: calc(100% - 55px);
}

.container {
  display: block;
  padding: 10px 20px 0 20px;
}

.buttons {
  display: flex;
  height: 60px;
}

.button {
  margin-right: 10px;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  padding: 10px;
  background: #e3e3e3;
}

.button:last-child {
  margin-right: 0;
}

.nn {
  display: flex;
  flex-direction: column;
}

.nn > * {
  padding: 0 20px;
}

.nn-list {
  overflow-y: auto;
}

.nn-list .neighbor {
  font-size: 12px;
  margin-bottom: 8px;
}

.nn-list .label-and-value {
  display: flex;
  justify-content: space-between;
}

.label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nn-list .value {
  color: #666;
  float: right;
  font-weight: 300;
  margin-left: 8px;
}

.nn-list .bar {
  position: relative;
  border-top: 1px solid rgba(0, 0, 0, 0.15);
  margin: 2px 0;
}

.nn-list .bar .fill {
  position: absolute;
  top: -1px;
  border-top: 1px solid white;
}

.nn-list .tick {
  position: absolute;
  top: 0px;
  height: 3px;
  border-left: 1px solid rgba(0, 0, 0, 0.15);
}

.nn-list .neighbor-link:hover {
  cursor: pointer;
}

.search-by {
  display: flex;
}

.search-by vz-projector-input {
  width: 100%;
}

.search-by paper-dropdown-menu {
  margin-left: 10px;
  width: 100px;
}

.distance .options {
  float: right;
}

.options a {
  color: #727272;
  font-size: 13px;
  margin-left: 12px;
  text-decoration: none;
}

.options a.selected {
  color: #009EFE;
}

.neighbors {
  margin-bottom: 30px;
}

.neighbors-options {
  margin-top: 6px;
}

.neighbors-options .option-label, .distance .option-label {
  color: #727272;
  margin-right: 2px;
  width: auto;
}

.num-neighbors-container {
  display: inline-block;
}

#nn-slider {
  margin: 0 -12px 0 10px;
}

.euclidian {
  margin-right: 10px;
}

.matches-list {
  padding: 0 20px;
}

.matches-list .row {
  border-bottom: 1px solid #ddd;
  cursor: pointer;
  display: flex;
  font-size: 12px;
  margin: 5px 0;
  padding: 4px 0;
}

.results {
  display: flex;
  flex-direction: column;
}
</style>
<template>
<div class="container">
  <div class="buttons">
    <button class="button reset-filter">Show All Data</button>
    <button class="button set-filter">Isolate selection</button>
    <button class="button clear-selection">Clear selection</button>
  </div>
  <div class="search-by">
    <vz-projector-input id="search-box" label="Search"></vz-projector-input>
    <paper-dropdown-menu no-animations label="by">
      <paper-listbox attr-for-selected="value" class="dropdown-content" selected="{{selectedMetadataField}}">
        <template is="dom-repeat" items="[[metadataFields]]">
          <paper-item value="[[item]]" label="[[item]]">
            [[item]]
          </paper-item>
        </template>
      </paper-listbox>
    </paper-dropdown-menu>
  </div>
</div>
<div class="results">
  <div class="nn" style="display: none">
    <div class="neighbors">
      <div class="neighbors-options">
        <div class="slider num-nn">
          <span class="option-label">neighbors</span>
          <paper-icon-button icon="help" class="help-icon"></paper-icon-button>
          <paper-tooltip position="bottom" animation-delay="0" fit-to-visible-bounds>
            The number of neighbors (in the original space) to show when clicking on a point.
          </paper-tooltip>
          <paper-slider id="nn-slider" pin min="5" max="1000" value="100"></paper-slider>
          <span class="nn-count"></span>
        </div>
      </div>
      <div class="distance">
        <span class="option-label">distance</span>
        <div class="options">
          <a class="selected cosine" href="javascript:void(0);">COSINE</a>
          <a class="euclidean" href="javascript:void(0);">EUCLIDIAN</a>
        </div>
      </div>
    </div>
    <p>Nearest points in the original space:
    <div class="nn-list"></div>
  </div>
  <div class="matches-list" style="display: none">
    <div class="list"></div>
    <div class="limit-msg">Showing only the first 100 results...</div>
  </div>
</div>
<!-- Closing global template -->
</template>
</dom-module>
